package com.example.multilpeDataSource.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author wangzhendong
 * @data 2020-02-08 13:08
 */
public class DynamicDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        System.out.println("切换到数据源{}"+DataSourceContextHolder.getDB());
        return DataSourceContextHolder.getDB();
    }
}
